﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Manageweb_ManageInfo : System.Web.UI.Page
{
    MODEL.WebInfo MWI = new MODEL.WebInfo();
    MODEL.WebInfo _MWI = new MODEL.WebInfo();

    BLL.WebInfo BWI = new BLL.WebInfo();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Cookies["MasterID"] == null)
        {
            Response.Redirect("Default.aspx");
        }

        if (!IsPostBack)
        {
            if (Request.QueryString["WebInfoID"] == null)
            {
                Response.Redirect("Welcome.aspx");
            }
            else
            {
                LB_ID.Text = Request.QueryString["WebInfoID"].ToString();

                PageDataInit();
            }
        }
        
    }


    #region 页面数据初始化 [初始化]
    protected void PageDataInit()
    {
        try
        {
            MWI.WI_ID = Convert.ToInt32(LB_ID.Text);

            _MWI = BWI.GetDataByID(MWI);

            LB_Title.Text = _MWI.WI_Title;
            FTB_Content.Text = _MWI.WI_Content;
        }
        catch (Exception ex)
        {
            LB_ManageInfo.Text = ex.Message;
        }
    }
    #endregion


    #region 提交修改 [Click]
    protected void Btn_Submit_Click(object sender, EventArgs e)
    {
        try
        {
            MWI.WI_ID = Convert.ToInt32(LB_ID.Text);
            MWI.WI_Content = FTB_Content.Text;

            BWI.ModContentByID(MWI);

            LB_ManageInfo.Text = "修改成功";
        }
        catch (Exception ex)
        {
            LB_ManageInfo.Text = ex.Message;
        }
    }
    #endregion
}
